<template>
  <el-select
    v-model="selectedNetwork"
    placeholder="请选择所属网点"
    style="width: 100%"
    @change="handleChange"
  >
    <el-option
      v-for="item in networkList"
      :key="item.id"
      :label="item[keyName]"
      :value="item.id"
    />
  </el-select>
</template>

<script>
export default {
  props: {
    networkList: {
      type: Array,
      default: () => []
    },
    keyName: {
      type: String,
      default: 'networkName'
    }
  },
  data() {
    return {
      selectedNetwork: ''
    }
  },
  mounted() {},

  methods: {
    handleChange(val) {
      this.$emit('select', val)
      console.log('传参')
    }
  }
}
</script>
